define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'lejiaytj/userinfo/index' + location.search,
                    add_url: 'lejiaytj/userinfo/add',
                    edit_url: 'lejiaytj/userinfo/edit',
                    del_url: 'lejiaytj/userinfo/del',
                    multi_url: 'lejiaytj/userinfo/multi',
                    table: 'user_info',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'user_id',
                sortName: 'user_id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'user_id', title: __('User_id')},
                        {field: 'czlx', title: __('Czlx')},
                        {field: 'gzdw', title: __('Gzdw')},
                        {field: 'tel', title: __('Tel')},
                        {field: 'lxr', title: __('Lxr')},
                        {field: 'lxrtel', title: __('Lxrtel')},
                        {field: 'xueXing', title: __('Xuexing')},
                        {field: 'rhyx', title: __('Rhyx')},
                        {field: 'whcd', title: __('Whcd')},
                        {field: 'zhiYe', title: __('Zhiye')},
                        {field: 'hunYin', title: __('Hunyin')},
                        {field: 'yiBao', title: __('Yibao')},
                        {field: 'ywgm', title: __('Ywgm')},
                        {field: 'bls', title: __('Bls')},
                        {field: 'jiBing', title: __('Jibing')},
                        {field: 'shouShu', title: __('Shoushu')},
                        {field: 'waiShang', title: __('Waishang')},
                        {field: 'shuXue', title: __('Shuxue')},
                        {field: 'jzs', title: __('Jzs')},
                        {field: 'yiChuan', title: __('Yichuan')},
                        {field: 'canJi', title: __('Canji')},
                        {field: 'chuFang', title: __('Chufang')},
                        {field: 'ranLiao', title: __('Ranliao')},
                        {field: 'yinShui', title: __('Yinshui')},
                        {field: 'ceSuo', title: __('Cesuo')},
                        {field: 'qinChuLan', title: __('Qinchulan')},
                        {field: 'dev_no', title: __('Dev_no')},
                        {field: 'utime', title: __('Utime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'vender_id', title: __('Vender_id')},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});